<include file="common:__head__"/>
<div class="permissions-tabs">
    <a class="role tabs-bg" href="{:U('Brand/index')}">品牌列表</a>
</div>
    <form class="form-horizontal" id="brand_form" action="{:U('Brand/edit')}" method="post">
        <input type="hidden" name="brand_id" value="{$brand['id']}"/>
        <div class="permissions-content">
            <div class="permissions-le">
                <span class="add-admin"><a href="javascript:history.go(-1)"></a>修改品牌</span>
                <div class="add-admin-ipt">
                    <span><i>*</i>品牌名称:</span>
                    <input type="text" name="b_name" id="b_name" placeholder="请填写品牌名称" class="w200" value="{$brand['b_name']}"/>
                </div>
                <div class="add-admin-ipt">
                    <span>是否代理品牌:</span>
                    <select name="brand" id="brand">
                        <option value="0">否</option>
                        <option value="1" <if condition="$brand['agent_brand'] eq 1">selected</if> >是</option>
                    </select>
                </div>
                <div class="add-admin-ipt">
                    <span><i>*</i>返利方式:</span>
                    <select name="rebate" id="rebate">
                        <option value="0">-- 请选择 --</option>
                        <foreach name="rebates" item="rebate">
                            <option value="{$rebate['re_id']}" <if condition="$brand['rebate_id'] eq $rebate['re_id']">selected</if> >{$rebate['type_name']}</option>
                        </foreach>
                    </select>
                </div>
                <div class="add-admin-ipt">
                    <span><i>*</i>品牌图片:</span>
                    <div class="add-admin-opt">
                        <div class="input-file-show">
                            <span class="show">
                                <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="">
                                    <i id="img_i" class="fa fa-picture-o" onmouseover="layer.tips('<img src={$brand.pic}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                                </a>
                            </span>
                            <span class="type-file-box">
                                <input type="text" id="image" name="pic" value="{$brand.pic}" class="type-file-text">
                                <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                                <input class="type-file-file" onClick="GetUploadify(1,'','brand','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                            </span>
                        </div>
                        <span class="err"></span>
                        <p class="notic">品牌图片，最佳显示尺寸为148*28像素</p>
                    </div>
                </div>
                <div class="add-admin-ipt">
                    <span></span>
                    <a class="btn-lg btn-blue" id="submitBtn">保存</a>
                </div>
            </div>
            <div class="permissions-ri">
                <a href="" class="permissions-help">帮助和服务</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">

    function img_call_back(fileurl_tmp) {
        $("#image").val(fileurl_tmp);
        $("#img_a").attr('href', fileurl_tmp);
        $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
    }

    $(function(){
        $("#submitBtn").click(function() {
            var b_name = $('#b_name').val();
            var rebate = $('#rebate').val();
            var brand  = $('#brand').val();
            var image = $('#image').val();
            if (b_name == '') {
                layer.msg('请填写品牌名称!',{icon:2, time:1000});
                return false;
            }
            if (rebate == 0 && brand==1) {
                layer.msg('请选择返利方式!', {icon:2, time:1000});
                return false;
            }
            $("#brand_form").submit();
        });
    });
</script>
<include file="common:__foot__"/>